import 'package:shining_red_star/model/unique.dart';

class SomeThingGroup {
  final String id;
  final String title;

  const SomeThingGroup({
    required this.id,
    required this.title,
  });

  factory SomeThingGroup.fromJson(Map<String, dynamic> json) {
    return SomeThingGroup(
      id: json['id'],
      title: json['title'],
    );
  }

  static List<SomeThingGroup> jsonToList(List<dynamic> json) {
    return json.map((item) => SomeThingGroup.fromJson(item)).toList();
  }
}

class SomeThingInfo implements Unique {
  @override
  final String id;
  final String title;
  final List<String> img;
  final String pinYin;
  final String aud;
  final List<String> group;

  const SomeThingInfo({
    required this.id,
    required this.title,
    required this.img,
    required this.pinYin,
    required this.aud,
    required this.group,
  });

  factory SomeThingInfo.fromJson(Map<String, dynamic> json) {
    return SomeThingInfo(
      id: json['id'],
      title: json['title'],
      img: List.from(json['img']),
      pinYin: json['pinYin'],
      aud: json['aud'],
      group: List.from(json['group']),
    );
  }

  static List<SomeThingInfo> jsonToList(List<dynamic> json) {
    return json.map((item) => SomeThingInfo.fromJson(item)).toList();
  }
}
